package com.afs.electronicforensics.monitor;

import android.graphics.Color;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.TextView;

import com.afs.electronicforensics.activity.R;

public class FileUpMonitorEditText implements TextWatcher {
    private TextView textView;
    private EditText[] text;

    public void SetMonitorEditText(final TextView textView, final EditText... text) {

        this.textView = textView;
        this.text = text;


        for (int i = 0; i < text.length; i++) {

            if (text[i] != null) {
                text[i].addTextChangedListener(FileUpMonitorEditText.this);
            }

        }
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count,
                                  int after) {
        // TODO Auto-generated method stub
    }
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {
        // TODO Auto-generated method stub
        for (int i = 0; i < text.length; i++) {

            if (text[i].length() == 0) {
                textView.setTextColor(Color.parseColor("#AAAAAA"));
                textView.setEnabled(false);
                return;
            } else {
                textView.setTextColor(Color.parseColor("#88BEF5"));
                textView.setEnabled(true);
            }
        }
    }
}
